<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="add">
      <h2>{{msg}}</h2>
      <!-- @是v-on的简写 -->
      <button @click="reverse">反转</button>
    </div>
    <script src="../vue.js"></script>
    <script>
      new Vue({
        el: "#add",
        data: {
          msg: "hello word",
        },
        methods: {
          reverse() {
            //split('')转数组
            //reserve('')反转
            //join('')转字符串
            this.msg = this.msg.split("").reverse("").join("")
          },
        },
      })
    </script>
  </body>
</html>
